<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../css/tc/tc1.css" />
		<script src="../../js/getParameter.js"></script>
		<script src="../../js/jquery3.js"></script>
		<script src="../../layui/layui.js"></script>
	</head>
	<script>
		$(function (){
			layui.use('layer', function () {
				var layer = layui.layer;
			let prId = getParameter("prId");

			let uId = getParameter("uid");

			$.post("/product/findByIdProduct",{"prId":prId},function (res){
				$("#prName").val(res.prName);
				$("#prNum").val(res.prNum);
				$("#prPrice").val(res.prPrice);
				$("#prDescribe").html(res.prDescribe);
				$("#prStatus").val(res.prStatus);
			})

			$(".form").submit(function () {

				$.ajaxSettings.async = false;
				$.post("/product/updateProduct?uId="+uId+"&prId="+prId, $(this).serialize(), function (data) {
					if (data == "success") {
						layer.msg('修改成功',{icon:6,time:2000}, function(){
							window.parent.location.reload(); //刷新父页面
							var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
							parent.layer.close(index);
						});
					}
				})

				return false;
			})
			})
		})
	</script>
	<body>

		<div class="cd-popup-container">
			<p></p>
			<div class="cd-buttons" style="margin-left: 40px;margin-top: 40px;">
				<form class="form" >
					<div class="bd1">
						<div><span>产品名称：</span><br><input type="text" name="prName" id="prName"  disabled/></div>
						<div><span>存量：</span><br><input type="text" name="prNum" id="prNum" /></div>
						<div><span>单价(人民币)：</span><br><input type="text" name="prPrice" id="prPrice"  />
						</div>
						<div><span>产品描述：</span><br>
							<textarea style="resize:none;width: 480px;height: 150px;" name="prDescribe" id="prDescribe"></textarea>
						</div>

					</div>
					<div class="bd2">
						<div><span>产品状态：</span><br>
							<select id="prStatus" name="prStatus" class="from">
								<option value="已上架">已上架</option>
								<option value="未上架">未上架</option>
							</select></div>

					</div>

					<input type="submit" value="修改" class="submit" />
				</form>
			</div>
		</div>

	</body>
</html>
